import axios from "./httpInterceptor";
import vm from "@/main";

const request = (config, isHandleError = true) => {
  if (!config) {
    vm.$messagebox.alert("请求参数不能为空");
    return Promise.resolve({});
  }
  return axios(config).then(res => {
    if (res.respCode !== "000000"  && isHandleError) {
      console.log(res)
      if(res.respCode == "11510") {
        return res;
      }
      vm.$messagebox.alert(res.respMsg);
      return {};
    } else {
      return res;
    }
  });
};
export default request;
